package me.helllp.book.concurrent.ch05;

import java.text.MessageFormat;

/**
 * 并行任务进行计算：(A+B)*A/2
 * 
 * @author Administrator
 *
 */
public class PStreamMain {
	public static void main(String[] args) {
		new Thread(new Plus()).start();
		new Thread(new Multiply()).start();
		new Thread(new Div()).start();
		
		for(int i=1; i<= 1000; i++){
			for(int j=1; j<=1000; j++){
				Msg msg = new Msg();
				msg.i = i;
				msg.j = j;
				msg.orgStr = MessageFormat.format("({0}+{1})*{0}/2", msg.i, msg.j);
				Plus.bq.add(msg);
			}
		}
	}
}
